package pl.vanta.utils.ejb.ejbqlb.parts;

import pl.vanta.utils.ejb.ejbqlb.conditions.ConditionType;
import pl.vanta.utils.ejb.ejbqlb.conditions.types.MultiValueCondition;
import pl.vanta.utils.ejb.ejbqlb.conditions.types.NoValueCondition;
import pl.vanta.utils.ejb.ejbqlb.conditions.types.OneValueCondition;
import pl.vanta.utils.ejb.ejbqlb.conditions.types.TwoValueCondition;

public class Field
{
	private String	name;
	private Where	where;

	public Field(Where where, String name)
	{
		this.name = name;
		this.where = where;
	}

	public String getName()
	{
		return this.name;
	}

	public TwoValueCondition BETWEEN(Number value1, Number value2)
	{
		return new TwoValueCondition(this.where, ConditionType.BETWEEN, value1, value2);
	}

	public TwoValueCondition NOT_BETWEEN(Number value1, Number value2)
	{
		return new TwoValueCondition(this.where, ConditionType.NOT_BETWEEN, value1, value2);
	}

	public OneValueCondition EQUALS(Object value)
	{
		return new OneValueCondition(this.where, ConditionType.EQUALS, value);
	}

	public OneValueCondition LIKE(String value)
	{
		return new OneValueCondition(this.where, ConditionType.LIKE, value);
	}

	public OneValueCondition NOT_LIKE(String value)
	{
		return new OneValueCondition(this.where, ConditionType.NOT_LIKE, value);
	}

	public OneValueCondition GREATER_THAN(Number value)
	{
		return new OneValueCondition(this.where, ConditionType.GREATER, value);
	}

	public OneValueCondition LESS_THAN(Number value)
	{
		return new OneValueCondition(this.where, ConditionType.LESS, value);
	}

	public OneValueCondition GREATER_OR_EQUAL(Number value)
	{
		return new OneValueCondition(this.where, ConditionType.GREATER_OR_EQUAL, value);
	}

	public OneValueCondition LESS_OR_EQUAL(Number value)
	{
		return new OneValueCondition(this.where, ConditionType.LESS_OR_EQUAL, value);
	}

	public OneValueCondition NOT_EQUALS(Object value)
	{
		return new OneValueCondition(this.where, ConditionType.NOT_EQUALS, value);
	}

	public OneValueCondition MEMBER_OF(String field)
	{
		return new OneValueCondition(this.where, ConditionType.MEMBER_OF, field);
	}

	public OneValueCondition NOT_MEMBER_OF(String field)
	{
		return new OneValueCondition(this.where, ConditionType.NOT_MEMBER_OF, field);
	}

	public MultiValueCondition IN(Object... values)
	{
		return new MultiValueCondition(this.where, ConditionType.IN, values);
	}

	public MultiValueCondition NOT_IN(Object... values)
	{
		return new MultiValueCondition(this.where, ConditionType.NOT_IN, values);
	}

	public NoValueCondition IS_NULL()
	{
		return new NoValueCondition(this.where, ConditionType.IS_NULL);
	}

	public NoValueCondition IS_NOT_NULL()
	{
		return new NoValueCondition(this.where, ConditionType.IS_NOT_NULL);
	}

	public NoValueCondition IS_EMPTY()
	{
		return new NoValueCondition(this.where, ConditionType.IS_EMPTY);
	}

	public NoValueCondition IS_NOT_EMPTY()
	{
		return new NoValueCondition(this.where, ConditionType.IS_NOT_EMPTY);
	}
}